package com.xuecheng.manage_course.service;

import com.xuecheng.framework.domain.course.ext.CategoryNode;
import com.xuecheng.manage_course.dao.CategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ShengJinFeng
 * @version V1.0
 * @ClassName CategoryService
 * @Description (这里用一句话描述这个类的作用)
 * @date 2020/2/3 14:30
 * @since V1.0
 */
@Service
public class CategoryService {

    @Autowired
    private CategoryMapper categoryMapper;

    /**
     * @Description 查询分类
     * @author ShengJinFeng
     * @date 2020/2/3
     */
    public CategoryNode findCategoryList() {
        CategoryNode categoryNode = categoryMapper.selectList();
        /*List<CategoryNode> children = categoryNode.getChildren();
        children.forEach(node ->{
            List<CategoryNode> child = node.getChildren();
            child.forEach(n ->{
                n.setChildren(null);
            });
        });*/
        return categoryNode;
    }
}
